#include <ros/ros.h>
#include <std_msgs/UInt8.h>
#include <std_msgs/Empty.h>

using namespace std;

int main (int argc, char **argv)
{
    ros::init(argc,argv,"mode_pub");
    ros::NodeHandle nh;


    ros::Rate loop_rate(5);
    cout<<"start_pub"<<endl;

    ros::Publisher motormode_pub = nh.advertise<std_msgs::UInt8>("/mode",1000);  //需要放置到循环外面
    while (ros::ok())
    {
        
        std_msgs::UInt8 mode;               
        mode.data = 10;
        motormode_pub.publish(mode);
        cout<<"pub_done"<<endl;
        ros::spinOnce();
        loop_rate.sleep();
    }
    return 0;
}
